import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import {
  Button,
  Form,
  FormItem,
  Input,
  Message,
  Container,
  Header,
  Aside,
  Main,
  Menu,
  Submenu,
  MenuItemGroup,
  MenuItem,
  RadioButton,
  RadioGroup,
  Breadcrumb,
  BreadcrumbItem,
  Card,
  Row,
  Col,
  Table,
  TableColumn,
  Switch,
  Tooltip,
  Pagination,
  Dialog,
  MessageBox,
  Tag,
  Tree,
  Select,
  Option,
  Cascader,
  Alert,
  Tabs,
  TabPane,
  Steps,
  Step,
  CheckboxGroup,
  Checkbox,
  Upload,
} from "element-ui";
//  引入富文本编辑器
import VueQuillEditor from "vue-quill-editor";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
import axios from "axios";
// 树形结构表格
import TreeTbale from "vue-table-with-tree-grid";
//全局样式表
import "./assets/css/global.css";
// 第三方字体图标
import "./assets/css/iconfont.css";
import moment from "moment";

Vue.config.productionTip = false;
Vue.prototype.$http = axios;
// 配置请求根路径
axios.defaults.baseURL = "http://127.0.0.1:8888/api/private/v1/";
Vue.use(Button);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Container);
Vue.use(Header);
Vue.use(Aside);
Vue.use(Main);
Vue.use(Menu);
Vue.use(Submenu);
Vue.use(MenuItemGroup);
Vue.use(MenuItem);
Vue.use(RadioButton);
Vue.use(RadioGroup);
Vue.use(Breadcrumb);
Vue.use(BreadcrumbItem);
Vue.use(Card);
Vue.use(Row);
Vue.use(Col);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Switch);
Vue.use(Tooltip);
Vue.use(Pagination);
Vue.use(Dialog);
Vue.use(Tag);
Vue.use(Tree);
Vue.use(Select);
Vue.use(Option);
Vue.use(Cascader);
Vue.use(Alert);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Steps);
Vue.use(Step);
Vue.use(CheckboxGroup);
Vue.use(Checkbox);
Vue.use(Upload);
Vue.prototype.$message = Message;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.use(VueQuillEditor);

Vue.component("tree-table", TreeTbale);
Vue.filter("dateFormat", function (dataStr, pattern = "YYYY-MM-DD HH:mm:ss") {
  return moment(dataStr).format(pattern);
});
// Vue.filter("dateFormat", function (originVal) {
//   const dt = new Date(originVal);
//   const y = dt.getFullYear();
//   const m = (dt.getMonth() + 1 + "").padStart(2, "0");
//   const d = (dt.getDate() + "").padStart(2, "0");
//   const hh = (dt.getHours() + "").padStart(2, "0");
//   const mm = (dt.getMinutes() + "").padStart(2, "0");
//   const ss = (dt.getSeconds() + "").padStart(2, "0");
//   return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
// });

new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
